<template>
  <view>
    <yy-paging
      v-model="dataList"
      @onRefresh="onRefresh"
      @query="queryList"
      @scroll="scroll"
      ref="paging"
      :auto="true"
      :refresher-enabled="true"
      :useVirtualList="false"
    >
      <template #top>
        <u-navbar
          :is-back="false"
          :background="{ backgroundColor: isScroll ? '#F2F5F7' : 'transparent' }"
          :border-bottom="false"
          :custom-style="{ transition: 'background-color 0.3s ease-in-out' }"
        >
          <view class="grid grid-cols-3 items-center px-3 w-full">
            <view class="flex col-span-1 items-center" @click="vk.navigateBack()">
              <image src="/static/dddr128.png" mode="aspectFill" class="size-6" />
            </view>
            <view class="line-clamp-1 flex col-span-1 justify-center">
              <view class="text-[#000] font-bold text-base"> 预估收益 </view>
            </view>
            <view class="flex col-span-1 justify-end">
              <view class="text-[.875rem] text-[#5C6068]"> </view>
            </view>
          </view>
        </u-navbar>
      </template>
      <template #empty>
        <yy-empty></yy-empty>
      </template>
      <template #loadingMoreNoMore>
        <yy-nomore></yy-nomore>
      </template>
      <view class="flex flex-col p-4">
        <view class="flex justify-between items-center py-3" v-for="(i, k) in dataList" :key="k">
          <view class="flex flex-col">
            <view class="flex gap-1 items-center">
              <image :src="vk.myfn.handleImageUrl(i.payUser.avatar)" class="size-4 rounded-full" mode="aspectFill" />
              <view class="text-[.875rem] text-[#161A24]"> {{ i.payUser.nickname }} 购买了钓点 </view>
            </view>
            <view class="text-[.75rem] text-[#5C6068] mt-[.125rem]">{{ i.basan.name }} </view>
            <view class="text-[.75rem] text-[#5C6068] mt-1">{{ vk.myfn.formatDateTime(i.create_time) }}</view>
          </view>
          <view class="text-[.875rem] text-[#FF9A07] font-medium">+{{ i.amount }} </view>
        </view>
      </view>
    </yy-paging>
    <!-- 组件 -->
  </view>
</template>

<script>
  export default {
    data() {
      return {
        isScroll: false, // 控制页面滚动时导航栏背景色变化
        dataList: [], // 存储预估收益列表数据

        options: {}
      }
    },
    onLoad(options) {
      this.options = options
    },
    onShow() {},
    methods: {
      // 下拉刷新回调
      onRefresh() {},
      // 返回上一页
      returnToPage() {
        vk.navigateBack()
      },
      // 监听页面滚动
      scroll(e) {
        this.isScroll = e.detail.scrollTop > 0
      },
      // 分页查询列表数据
      async queryList(page, limit) {
        let res = await api.estimateIncome({
          page,
          limit
        })
        console.log('res==> ', res)
        this.$refs.paging.complete(res.data)
      }
    }
  }
</script>

<style lang="scss" scoped></style>
